﻿namespace Sunny.Com;

/// <summary>
/// 串口数据类型
/// </summary>
public enum ComDataType
{
    /// <summary>
    /// ASCII字符串
    /// </summary>
    ASCII,

    /// <summary>
    /// 十六进制
    /// </summary>
    HEX
}

/// <summary>
/// 串口数据事件参数
/// </summary>
public ref struct ComDataEventArgs
{
    /// <summary>
    /// 字符串数据
    /// </summary>
    public string String { get; set; }

    /// <summary>
    /// 字节数组数据
    /// </summary>
    public byte[] Buffer { get; set; }
}

/// <summary>
/// 串口数据事件委托
/// </summary>
/// <param name="sender">对象</param>
/// <param name="e">参数</param>
public delegate void ConnectedEventHandler(ComPort sender, ComDataEventArgs e);